#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QGLWidget>
#include <QTimer>
#include <QTime>

const int NUM_STARS(50);

class GLWidget : public QGLWidget
{
  Q_OBJECT

public:
  GLWidget(QWidget* parent = 0, unsigned int fps = 30);
  virtual ~GLWidget();

protected:
  virtual void initializeGL();
  virtual void resizeGL(int w, int h);
  virtual void paintGL();
  virtual void keyPressEvent(QKeyEvent *e);

  void loadGLTexture(const QString& filename, GLuint textures[3]);

signals:
  void fps(unsigned int);

private:
  QTimer mTimer;
  QTime mTime;
  unsigned int mFramesPainted;

  GLuint mTextures[1];

  struct Star
  {
    int mR;
    int mG;
    int mB;

    double mDistance;
    double mAngle;
  };

  Star mStars[NUM_STARS];
  double mZoom;
  double mTilt;
  double mSpin;
  bool mTwinkle;
};

#endif
